#include "time.h"

/**
 * Invokes a delay with used-defined length
 * @author david dot asabina at gmail dot com
 * @param iterations the count of iterations within the delay loop
 * @todo implement asm for time-critical operation
 */
void delay(uint16_t iterations){
  uint16_t x = 0;
  
  while(x < iterations){
    x++;
  }
}

/**
 * Invokes a delay with a user-defined time
 * @author david dot asabina at gmail dot com
 * @param time the duration in milliseconds
 * @todo implement asm for time-critical operation
 */
void delayms(uint16_t ms){
  uint16_t x = 0;
  
  while(x < ms){
    // count a millisecond
    delay(16000/20/2);
    x++;
  }
}
